home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / create6a / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-15  |  6.8 KB  |  224 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Caption         =   "Program Manager Example"
  4.    ClientHeight    =   3300
  5.    ClientLeft      =   60
  6.    ClientTop       =   630
  7.    ClientWidth     =   4110
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    ScaleHeight     =   3300
  11.    ScaleWidth      =   4110
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton Command4 
  14.       Caption         =   "Load Program"
  15.       Height          =   375
  16.       Left            =   600
  17.       TabIndex        =   4
  18.       Top             =   2520
  19.       Width           =   1335
  20.    End
  21.    Begin VB.CommandButton Command3 
  22.       Caption         =   "Remove File"
  23.       BeginProperty Font 
  24.          Name            =   "Arial"
  25.          Size            =   8.25
  26.          Charset         =   0
  27.          Weight          =   400
  28.          Underline       =   0   'False
  29.          Italic          =   0   'False
  30.          Strikethrough   =   0   'False
  31.       EndProperty
  32.       Height          =   375
  33.       Left            =   2160
  34.       TabIndex        =   3
  35.       Top             =   2520
  36.       Width           =   1335
  37.    End
  38.    Begin VB.TextBox Text1 
  39.       Appearance      =   0  'Flat
  40.       BackColor       =   &H00C0C0C0&
  41.       BeginProperty Font 
  42.          Name            =   "Arial"
  43.          Size            =   8.25
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Height          =   285
  51.       Left            =   600
  52.       Locked          =   -1  'True
  53.       TabIndex        =   2
  54.       Top             =   2040
  55.       Width           =   3375
  56.    End
  57.    Begin VB.ListBox List1 
  58.       BeginProperty Font 
  59.          Name            =   "Arial"
  60.          Size            =   8.25
  61.          Charset         =   0
  62.          Weight          =   700
  63.          Underline       =   0   'False
  64.          Italic          =   0   'False
  65.          Strikethrough   =   0   'False
  66.       EndProperty
  67.       Height          =   1530
  68.       Left            =   120
  69.       TabIndex        =   0
  70.       ToolTipText     =   "Double-Click to load program"
  71.       Top             =   360
  72.       Width           =   3855
  73.    End
  74.    Begin VB.Label Label3 
  75.       Caption         =   "Visit my homepage: www.fpsoftware.bizland.com"
  76.       BeginProperty Font 
  77.          Name            =   "Arial"
  78.          Size            =   8.25
  79.          Charset         =   0
  80.          Weight          =   400
  81.          Underline       =   0   'False
  82.          Italic          =   0   'False
  83.          Strikethrough   =   0   'False
  84.       EndProperty
  85.       Height          =   255
  86.       Left            =   240
  87.       TabIndex        =   6
  88.       Top             =   3000
  89.       Width           =   3735
  90.    End
  91.    Begin VB.Line Line2 
  92.       BorderColor     =   &H8000000C&
  93.       X1              =   0
  94.       X2              =   4080
  95.       Y1              =   0
  96.       Y2              =   0
  97.    End
  98.    Begin VB.Line Line1 
  99.       BorderColor     =   &H80000009&
  100.       BorderWidth     =   4
  101.       X1              =   0
  102.       X2              =   4080
  103.       Y1              =   0
  104.       Y2              =   0
  105.    End
  106.    Begin VB.Label Label2 
  107.       Caption         =   "Programs:"
  108.       BeginProperty Font 
  109.          Name            =   "Arial"
  110.          Size            =   8.25
  111.          Charset         =   0
  112.          Weight          =   400
  113.          Underline       =   0   'False
  114.          Italic          =   0   'False
  115.          Strikethrough   =   0   'False
  116.       EndProperty
  117.       Height          =   255
  118.       Left            =   120
  119.       TabIndex        =   5
  120.       Top             =   120
  121.       Width           =   735
  122.    End
  123.    Begin VB.Label Label1 
  124.       Caption         =   "Path:"
  125.       BeginProperty Font 
  126.          Name            =   "Arial"
  127.          Size            =   8.25
  128.          Charset         =   0
  129.          Weight          =   400
  130.          Underline       =   0   'False
  131.          Italic          =   0   'False
  132.          Strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   255
  135.       Left            =   120
  136.       TabIndex        =   1
  137.       Top             =   2040
  138.       Width           =   375
  139.    End
  140.    Begin VB.Menu mnuFile 
  141.       Caption         =   "File"
  142.       Begin VB.Menu mnuAdd 
  143.          Caption         =   "&Add File..."
  144.       End
  145.       Begin VB.Menu mnuRemove 
  146.          Caption         =   "&Remove File"
  147.       End
  148.       Begin VB.Menu hl1 
  149.          Caption         =   "-"
  150.       End
  151.       Begin VB.Menu mnuExit 
  152.          Caption         =   "&Exit"
  153.       End
  154.    End
  155. Attribute VB_Name = "frmMain"
  156. Attribute VB_GlobalNameSpace = False
  157. Attribute VB_Creatable = False
  158. Attribute VB_PredeclaredId = True
  159. Attribute VB_Exposed = False
  160. Private Sub Command3_Click()
  161. If List1 = "" Then: Exit Sub ' this is here to prevent a bug
  162. iniPath$ = App.Path & "\progmansav.ini"
  163. 'Erases from Program Save file
  164. entry$ = ""
  165. r% = WritePrivateProfileString("Program" & frmMain.List1.ListIndex, "Description", entry$, iniPath$)
  166. List1.RemoveItem List1.ListIndex
  167. Text1.Text = ""
  168. End Sub
  169. Private Sub Command4_Click()
  170. Dim pid As Long
  171. If List1 = "" Then: Exit Sub
  172.     Call Shell(Text1.Text, vbNormalFocus)
  173. End Sub
  174. Private Sub Form_Load()
  175. Dim strItem As String
  176. Dim strDir As String
  177. On Error Resume Next
  178. strDir = App.Path & "\progmansav2.ini" ' directory path
  179. Open strDir For Input As #1 '<-loading list
  180. While Not EOF(1)
  181.     Input #1, strItem
  182.     DoEvents
  183.         List1.AddItem strItem 'replace ListBox With your listbox
  184.     Wend
  185.     Close #1
  186. End Sub
  187. Private Sub Form_Unload(Cancel As Integer)
  188. mnuExit_Click
  189. End Sub
  190. Private Sub List1_Click()
  191. iniPath$ = App.Path & "\progmansav.ini"
  192. Text1.Text = GetFromINI("Program" & List1.ListIndex + 1, "Path", iniPath$)
  193. End Sub
  194. Private Sub List1_DblClick()
  195. Dim pid As Long
  196. If List1 = "" Then: Exit Sub
  197.     Call Shell(Text1.Text, vbNormalFocus)
  198. End Sub
  199. Private Sub mnuAdd_Click()
  200. Load frmAddFile
  201. frmAddFile.Show
  202. End Sub
  203. Private Sub mnuExit_Click()
  204.     Dim strDir As String
  205.     Dim lngSave As Long
  206.     On Error Resume Next
  207.     strDir = App.Path & "\progmansav2.ini"
  208.     Open strDir For Output As #1 '<- saving list
  209.     For lngSave& = 0 To List1.ListCount - 1
  210.         Print #1, List1.List(lngSave&) 'replace ListBox With your listbox
  211.     Next lngSave&
  212.     Close #1
  213. Unload Me
  214. End Sub
  215. Private Sub mnuRemove_Click()
  216. If List1 = "" Then: Exit Sub ' this is here to prevent a bug
  217. iniPath$ = App.Path & "\progmansav.ini"
  218. 'Erases from Program Save file
  219. entry$ = ""
  220. r% = WritePrivateProfileString("Program" & frmMain.List1.ListIndex, "Description", entry$, iniPath$)
  221. List1.RemoveItem List1.ListIndex
  222. Text1.Text = ""
  223. End Sub
  224.